package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 汤奇
 * @version V1.0
 * @Project BookPro
 * @Package com.qf.controller
 * @Description: 演示跨域访问问题和解决方案
 * @Date 2022/6/9 10:17
 */
@Controller
@RequestMapping("/origin")
public class CrossController {
    @RequestMapping("/test1")
    @ResponseBody
    //解决跨域访问问题
    @CrossOrigin("http://localhost:8081")//允许来自8081服务器的请求
    public String test1(){
        System.out.println("=========="+"请求访问CrossController");
        return "响应成功";
    }
}
